﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;

namespace MeTV
{
    class ChannelManager : IEnumerable
    {
        private Dictionary<int, Channel> dictionary = new Dictionary<int, Channel>();

        public Channel GetByChannelID(int id)
        {
            return dictionary[id];
        }

        public void Add(Channel channel)
        {
            dictionary[channel.ID] = channel;
        }

        public Channel First
        {
            get
            {
                return dictionary == null || dictionary.Count == 0 ? null : dictionary.First().Value;
            }
        }
        public int Count { get { return dictionary.Count; } }

        public IEnumerator GetEnumerator()
        {
            return dictionary.Values.GetEnumerator();
        }
    }
}
